//
//  SongerListTableViewCell.m
//  DayByDay
//
//  Created by dllo on 16/5/20.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "SongerListTableViewCell.h"
#import <UIImageView+WebCache.h>

@interface SongerListTableViewCell ()

@property (nonatomic, strong)UILabel *nameLabel;
@property (nonatomic, strong)UIImageView *imageV;
@property (nonatomic, strong)UIImageView *smallImageV;

@end

@implementation SongerListTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}


- (void)createView {
    self.imageV = [UIImageView new];
    self.nameLabel = [UILabel new];
    self.smallImageV = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH - 70, 10, 15, 15)];
    self.smallImageV.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.smallImageV];
    [self.contentView addSubview:self.imageV];
    [self.contentView addSubview:self.nameLabel];
    self.smallImageV.image = [UIImage imageNamed:@"global_icon_list_enter"];
    self.nameLabel.backgroundColor = [UIColor clearColor];
    self.imageV.backgroundColor = [UIColor clearColor];
}

- (void)setModel:(SongerListDataListModel *)model {
    _model = model;
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:_model.picUrl] placeholderImage:[UIImage imageNamed:@"smiley_26"]];
    NSLog(@"%@",_model.picUrl);
    self.nameLabel.text = _model.name;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.imageV.frame = CGRectMake(10, 10, 50, 50);
    self.imageV.layer.cornerRadius = 25;
    self.imageV.layer.masksToBounds = YES;
    self.nameLabel.frame = CGRectMake(70, 20, WIDTH - 150, 30);

}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
